package com.demo.bigdata.sql

import org.apache.spark.sql.{SaveMode, SparkSession}

object HiveDemo {
  def main(args: Array[String]): Unit = {
    val spark = SparkSession
      .builder()
      .config("spark.sql.warehouse.dir","/user/hive/warehouse")
      .enableHiveSupport()
      .appName("Hive Demo")
      .master("local")
      .getOrCreate()

    val df = spark.sql("select * from etl_order")
    df.write.mode(SaveMode.Overwrite).saveAsTable("dw_fact_order")
  }
}
